/*
 * Gallery.h
 *
 *  Created on: 28/04/2013
 *      Author: roger
 */

// TODO: test with an image in the SD (done)
// Find a way to select alt Gallery, ie browse all Gallery
//--press an image goes to next one and cycle at the end.
// this MUST be faster than it is, the microtouch algorithm works much faster using the IM2 format
// so see if we can use that.
// the bulk of the time (20 seconds) is used to read the file.
// we can try making the buffer larger? Or we can store the Gallery in a more compact format
// ie the color565 format. Is this what im2 actually is?
// if we can use the more compact format we can have fewer reads and larger buffers.
// ... BMP and TFT files are actually okay. Add more files...done
// Files need to be 320x240 BMP, use default export options from Gimp.

#ifndef Gallery_H_
#define Gallery_H_
#include "AppRegistry.h"
#include "ImageDisplayBMP.h"
#include "ImageDisplayTFT.h"
#include "ImageDisplay.h"

//#define GALLERY_DEBUG

class Gallery : public App {
private:
	virtual char *findNextFile();
	virtual void setup();
	File m_root;
	char m_lastName[20];

public:
	Gallery();
	virtual unsigned long getUpdateInterval() {return 1000000UL;};
	virtual void init();
	virtual void display();
	virtual boolean touch(Point p);
	virtual const char* getName() {return PSTR("Gallery");};
	void imgDraw(char *filename, int x, int y);
	virtual ~Gallery();
	// Fix to cope with odd stuff in the touch
	virtual void setMenuPos(int x1, int y1, int x2, int y2) {
		m_x1 = 86;
		m_y1 =82;
		m_x2 = 94;
		m_y2 =106;
	}
};

#endif /* Gallery_H_ */



